<?php 
header("Content-type: text/xml");
// $con = mysql_connect('localhost', 'root', 'super');
// if (!$con)
//   {
//   die('Could not connect: ' . mysql_error());
//   }

// mysql_select_db("db_tursib", $con);
 

require_once 'settings.php';
$sql="SELECT * FROM  t_stations  WHERE
`latitude`>'$_GET[latitude]'-0.015 and
`latitude`<'$_GET[latitude]'+0.015 and
`longitude`<'$_GET[longitude]'+0.015 and
`longitude`>'$_GET[longitude]'-0.015";


$result = mysql_query($sql);

//Build Result String
$data = "<?xml version='1.0' encoding='UTF-8' ?><xml>" ;
 

// Insert a new row in the table for each person returned
while($row = mysql_fetch_array($result)){
	$data .= "<item>";
	$data .= "<id>$row[id_station]</id>"; 
	$data .= "<lat>$row[latitude]</lat>";
	$data .= "<long>$row[longitude]</long>";
	$data .= "<name>$row[name]</name>";
	$data .= "<direction>$row[direction]</direction>";
	$data .= "<busses>$row[busses]</busses>";
	$data .= "</item>";

} 
$data .="</xml>";
echo $data;  

mysql_close($con);
?>